package com.enzoism.ai.flight.controller;

import com.enzoism.ai.flight.model.Flight;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/flights")
public class FlightController {

    @CrossOrigin
    @GetMapping
    public List<Flight> getFlights() {
        List<Flight> flights = new ArrayList<>();
        flights.add(new Flight(101, "徐庶", "2024-11-14", "青岛", "上海", "已确认", "ECONOMY"));
        flights.add(new Flight(102, "诸葛", "2024-11-16", "青岛", "天津", "已确认", "PREMIUM_ECONOMY"));
        flights.add(new Flight(103, "百里", "2024-11-18", "成都", "北京", "已确认", "ECONOMY"));
        flights.add(new Flight(104, "楼兰", "2024-11-20", "深圳", "杭州", "已确认", "BUSINESS"));
        flights.add(new Flight(105, "庄周", "2024-11-22", "成都", "大连", "已确认", "ECONOMY"));
        return flights;
    }
}